package rest;

import javax.servlet.ServletContext;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.PathSegment;
import java.io.InputStream;

/**
 * Created by alex on 15-1-20.
 */
@Path("/")
@Produces("text/html")
public class FileResource {

    @Context
    private ServletContext sc;
    
    @Path("/jquery/{id}")
    @GET
    public InputStream getJquery(@PathParam("id") PathSegment ps) {
        System.out.println(ps.getPath() + "-----------------------");
        return sc.getResourceAsStream("/jquery/" + ps.getPath());
    }
    

    
    @GET
    public InputStream getIndex() {
        return sc.getResourceAsStream("/index.html");
    }
}
